import org.junit.Test;

import static org.junit.Assert.*;


public class NGuessNumberTest
{
    @Test
    public void generateAnswerTest()
    {
        int[] arr = NGuessNumber.generateAnswer();
        for(int a = 0 ; a<arr.length ; a++)
        {
            for(int b = 0 ; b<arr.length ; b++)
            {
                if(arr[a] == arr[b] && a != b && (0<=arr[a] && arr[a]<=9))
                {
                    System.out.println("generateAnswer()测试未通过");
                    return;
                }
            }
        }
        System.out.println("generateAnswer()测试通过");
    }
    @Test
    public void getPlayerInputTest()
    {
        int[] arr = NGuessNumber.getPlayerInput();
        if(arr.length == 4)
        {
            System.out.println("getPlayerInput()测试通过");
        }
        else
        {
            System.out.println("getPlayerInput()测试未通过");
        }
    }
    @Test
    public void compareGuessAnswerTest()
    {
        int[] arr1 = {1,2,3,4};
        int[] arr2 = {2,3,4,1};
        boolean[] booleans1 = NGuessNumber.compareGuessAnswer(arr1,arr1);
        boolean[] booleans2 = NGuessNumber.compareGuessAnswer(arr1,arr2);
        boolean bool1 = true;
        boolean bool2 = false;
        for(int a = 0 ; a<4; a++)
        {
            if(!booleans1[a])
            {
                bool1 = false;
            }
            if(!booleans2[a])
            {
                bool2 = true;
            }
        }
        if(bool1 && bool2)
        {
            System.out.println("compareGuessAnswer()测试通过");
        }
        else
        {
            System.out.println("compareGuessAnswer()测试未通过");
        }
    }
    @Test
    public void isWinTest()
    {
        boolean[] boolean2 = {true,false,false,true};
        boolean[] boolean1 = {true,true,true,true};
        if(NGuessNumber.isWin(boolean1) && !NGuessNumber.isWin(boolean2))
        {
            System.out.println("isWin()测试通过");
        }
        else
        {
            System.out.println("isWin()测试未通过");
        }
    }
}
